package com.kaifa.org.tp02.example06.dao.impl;

import com.kaifa.org.tp02.example06.bean.User;
import com.kaifa.org.tp02.example06.dao.UserDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Repository;
//将UserDaoImpl这个实现类转变成Spring中的bean
@Repository("userDao")
public class UserDaoImpl implements UserDao {
    public void addUser() {
        ApplicationContext ac =new ClassPathXmlApplicationContext("applicationContext.xml");
        User us=ac.getBean("user",User.class);
        System.out.println(us);
        System.out.println("执行UserDaoImpl中的addUser方法");
    }
}
